<template>
  <base-breadcrumb>
    <a-card class="mb20">
      <titleName title="会议分类"></titleName>
      <div class="table-operator">
        <a-button type="primary" @click="visible=true">新增分类</a-button>
      </div>
      <s-table
        bordered
        ref="table"
        size="default"
        rowKey="key"
        :columns="columns"
        :data="loadData"
        :alert="true"
        show-size-changer
        show-quick-jumper
        showPagination="auto"
      ></s-table>
      <span slot="action" slot-scope="text, record">
        <a @click="editClassify(record);isEdit = true">编辑</a>
        <a-divider v-if="record.auditStatus == 'DRAFT'" type="vertical" />
        <a @click="delClassify(record)">删除</a>
      </span>
    </a-card>
    <a-modal
      :title="isEdit?'新增分类':'编辑分类'"
      :width="900"
      :visible="visible"
      @cancel="visible=false"
      @ok="submit"
    >
      <a-form-model
        ref="ruleForm"
        :model="form"
        :rules="rules"
        :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
        :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }"
      >
        <a-row :gutter="24">
          <a-col :md="12" :sm="12">
            <a-form-model-item label="分类名称：" prop="name">
              <BaseInput placeholder="请输入" v-model="form.name"></BaseInput>
            </a-form-model-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-model-item label="所属部门：" prop="isComplete">
              <a-select placeholder="请选择" v-model="form.name">
                <a-select-option
                  v-for="(item,index) in state"
                  :value="item.name"
                  :key="index"
                >{{item.name}}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-model-item label="状态" prop="size">
              <a-select placeholder="请选择" v-model="form.name">
                <a-select-option
                  v-for="(item,index) in state"
                  :value="item.name"
                  :key="index"
                >{{item.name}}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-modal>
  </base-breadcrumb>
</template>
<script>
import { STable } from '@/components'
const columns = [
    {
        title: '分类名称',
        dataIndex: 'name',
    },
    {
        title: '分类部门',
        dataIndex: 'fileName',
    },
    {
        title: '状态',
        dataIndex: 'fileFormat',
    },
    {
        title: '操作',
        dataIndex: 'action',
    },
]
const state = [
    {
        name: '可用',
        value: '1',
    },
    {
        name: '不可用',
        value: '0',
    },
]
export default {
    components: {
        STable,
    },
    data() {
        return {
            columns,
            state,
            //编辑控件
            isEdit: false,
            visible: false,
            form: {},
        }
    },
    methods: {
        submit() {
            if (this.isEdit) {
                //编辑
            } else {
                //新增
            }
        },
        editClassify() {},
        delClassify() {},
    },
}
</script>